<% content_for :header do %>
<div id="nav">
  <ul>
    <li><a href="/intro">活动介绍</a></li>
    <li><a href="/join">如何参与</a></li>
    <li><a href="/news" class="current">最新动态</a></li>
    <li><a href="/contact">联系我们</a></li>
  </ul>
</div>
<div id="pagetitle">
  <h1>最 新 动 态</h1>
</div>
<% end %>

<div id="content" class="wp">
    <h2>大家在多背一公斤做什么 ... <%= link_to "查看全部留言", :controller => 'broadcasts', :action => 'index' %></h2>
    <% for b in @broadcasts -%>
      <div>
        <% color = %w(orange purple red blue green) %>
        <span style="color:<%= color[rand(color.size)]%>">
          <% if b.from == 0 -%>
            <%= b.content %>
          <% else -%>
            <%= h b.content %>
          <% end -%>
        </span>
        <span class="sysmsg"><img src="/images/comment.png" /> <%= "by #{link_to b.sender.login, user_path(b.sender)}" unless b.from==0 %> <%= show_datetime b.created_at %></span>
      </div>
    <% end -%>
    <div id="post-comment" class="p">
      <div class="comment-tl"><img src="/images/comment_add.png" /> 我想说两句</div>
      <% form_for :broadcast, :url => {:controller => 'broadcasts', :action => 'create'} do |f| %>
        <%= f.text_area :content, :rows=>5 %>
        <p><%= submit_tag "发送" %></p>
      <% end -%>
    </div>
</div>